package com.example.demo.demo.invoke;

import com.example.demo.service.aiService.NluService;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class SpringAiInvoke implements CommandLineRunner {
    @Resource
    private ChatModel openAiModel;

    @Resource
    NluService nluService;

    private final ChatClient chatClient;

    // 通过构造函数自动注入配置好的ChatClient
    public SpringAiInvoke(ChatClient.Builder chatClientBuilder) {
        this.chatClient = chatClientBuilder.build();
    }
    @Override
    public void run(String... args) throws Exception {

        Prompt prompt = new Prompt(Prm.prm);
//        NluResult nluResult = nluService.performNlu("我昨天晚上因为我女朋友的男闺蜜，和她在微信上大吵了一架，现在好烦啊。");
//        System.out.println(nluResult.toString());
    }
}
